Evaluates the model of the following form.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | nway |
The number of interaction levels. Currently, this algorithm supports a maximum of three-way interaction. |
||
| real(kind=real64), | intent(in), | dimension(:) | :: | beta |
The model coefficients. |
|
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x |
The M-by-N matrix containing the M values of each of the N factors at which to evaluate the model. |
|
| logical, | intent(in), | optional, | target, dimension(:) | :: | map |
An optional array of the same size as beta that can be used to eliminate a parameter from the model (false), or keep a parameter in the model (true). If not supplied, all parameters will be assumed to be part of the model as if the array were filled with all true values. |
The resulting M-element array.
Evaluates the model of the following form.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(doe_model), | intent(in) | :: | mdl |
The model to evaluate. |
||
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x |
The M-by-N matrix containing the M values of each of the N factors at which to evaluate the model. |
The resulting M-element array.
ANOVA table for overall model fit assessment.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int32), | public | :: | df_model |
Model degrees of freedom. |
|||
| integer(kind=int32), | public | :: | df_residual |
Residual degrees of freedom. |
|||
| integer(kind=int32), | public | :: | df_total |
Total degrees of freedom. |
|||
| real(kind=real64), | public | :: | f_statistic |
F-statistic. |
|||
| real(kind=real64), | public | :: | ms_model |
Model mean square. |
|||
| real(kind=real64), | public | :: | ms_residual |
Residual mean square. |
|||
| real(kind=real64), | public | :: | p_value |
P-value for the F-test. |
|||
| real(kind=real64), | public | :: | r_squared |
R-squared value. |
|||
| real(kind=real64), | public | :: | ss_model |
Model sum of squares. |
|||
| real(kind=real64), | public | :: | ss_residual |
Residual sum of squares. |
|||
| real(kind=real64), | public | :: | ss_total |
Total sum of squares. |
Results from comparing two models.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=256), | public | :: | conclusion |
Interpretation of comparison results. |
|||
| integer(kind=int32), | public | :: | df_diff |
Difference in degrees of freedom. |
|||
| integer(kind=int32), | public | :: | df_full |
Degrees of freedom for full model. |
|||
| integer(kind=int32), | public | :: | df_reduced |
Degrees of freedom for reduced model. |
|||
| real(kind=real64), | public | :: | f_statistic |
F-statistic for model comparison. |
|||
| real(kind=real64), | public | :: | p_value |
P-value for the F-test. |
|||
| real(kind=real64), | public | :: | rss_full |
Residual sum of squares for full model. |
|||
| real(kind=real64), | public | :: | rss_reduced |
Residual sum of squares for reduced model. |
|||
| logical, | public | :: | significant_difference |
True if models differ significantly (p < 0.05). |
Model diagnostics and goodness-of-fit metrics.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public | :: | f_p_value |
P-value for the overall F-statistic. |
|||
| real(kind=real64), | public | :: | f_statistic |
Overall F-statistic for the model. |
|||
| real(kind=real64), | public | :: | mean_response |
Mean of the response variable. |
|||
| integer(kind=int32), | public | :: | n_observations |
Number of observations. |
|||
| integer(kind=int32), | public | :: | n_parameters |
Number of model parameters (including intercept). |
|||
| real(kind=real64), | public | :: | r_squared |
The coefficient of determination (R²), range [0, 1]. |
|||
| real(kind=real64), | public | :: | r_squared_adjusted |
The adjusted R² accounting for model complexity. |
|||
| real(kind=real64), | public | :: | residual_std_error |
Residual standard error (standard deviation of residuals). |
|||
| real(kind=real64), | public | :: | rmse |
Root mean square error. |
Design efficiency metrics for evaluating design quality.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public | :: | a_efficiency |
Higher is better. |
|||
| real(kind=real64), | public | :: | d_efficiency |
Range [0,1]. Higher is better (max=1 for orthogonal designs). |
|||
| real(kind=real64), | public | :: | g_efficiency |
G-efficiency: 1 - (max_prediction_variance / avg_prediction_variance) |
|||
| logical, | public | :: | is_orthogonal |
True if design is perfectly orthogonal. |
|||
| integer(kind=int32), | public | :: | n_factors |
Number of factors. |
|||
| integer(kind=int32), | public | :: | n_parameters |
Number of model parameters. |
|||
| integer(kind=int32), | public | :: | n_runs |
Number of design runs. |
|||
| real(kind=real64), | public | :: | orthogonality |
Orthogonality measure: if perfectly orthogonal, otherwise. |
A model used to represent a design of experiments result. The model is of the following form.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public, | allocatable, dimension(:) | :: | coefficients |
The model coefficients. |
||
| logical, | public, | allocatable, dimension(:) | :: | map |
An array denoting if a model coefficient should be included as part of the model (true), or neglected (false). |
||
| integer(kind=int32), | public | :: | nway |
The number of interaction levels. |
|||
| type(regression_statistics), | public, | allocatable, dimension(:) | :: | stats |
Statistical information for each model parameter. |
Results from RSM-based optimization.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | converged |
Whether optimization converged. |
|||
| real(kind=real64), | public | :: | convergence_tolerance |
Tolerance used for convergence. |
|||
| integer(kind=int32), | public | :: | iteration_count |
Number of iterations to converge. |
|||
| character(len=256), | public | :: | method |
Optimization method used. |
|||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | optimal_coded_factors |
Optimal factor settings (in coded scale). |
||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | optimal_natural_factors |
Optimal factor settings (in natural scale). |
||
| real(kind=real64), | public | :: | optimal_response |
Predicted response at optimal point. |
Prediction with uncertainty quantification.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public | :: | confidence_level |
Confidence level (e.g., 0.95 for 95% CI). |
|||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | confidence_lower |
Lower confidence interval bounds. |
||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | confidence_upper |
Upper confidence interval bounds. |
||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | predicted_values |
Predicted response values. |
||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | prediction_lower |
Lower prediction interval bounds. |
||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | prediction_upper |
Upper prediction interval bounds. |
Residual analysis data.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public, | allocatable, dimension(:) | :: | observed_values |
Observed response values. |
||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | predicted_values |
Predicted response values. |
||
| real(kind=real64), | public | :: | residual_mean |
Mean of residuals (should be ~0). |
|||
| real(kind=real64), | public | :: | residual_std |
Standard deviation of residuals. |
|||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | residuals |
Raw residuals: y - y_predicted. |
||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | standardized_residuals |
Standardized residuals for outlier detection. |
Response Surface Model (quadratic model for RSM).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(doe_model), | public | :: | base_model |
Base fitted model. |
|||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | interaction_coeff |
Interaction coefficients. |
||
| real(kind=real64), | public | :: | intercept |
Model intercept. |
|||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | linear_coeff |
Linear coefficients for each factor. |
||
| integer(kind=int32), | public | :: | n_factors |
Number of factors. |
|||
| real(kind=real64), | public, | allocatable, dimension(:) | :: | quadratic_coeff |
Quadratic coefficients (main effects squared). |
||
| real(kind=real64), | public | :: | response_at_center |
Predicted response at design center (coded 0,0,...,0). |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(doe_model), | intent(in) | :: | mdl1 | |||
| class(doe_model), | intent(in) | :: | mdl2 | |||
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x | ||
| real(kind=real64), | intent(in), | dimension(:) | :: | y |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x |
Fits a Taylor series model to the provided data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | nway |
The number of interaction levels. |
||
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x |
The M-by-N matrix containing the M values of each of the N factors used to produce the results. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | y |
An M-element array containing the results from the M experiments. |
|
| logical, | intent(in), | optional, | target, dimension(:) | :: | map |
An optional array of the same size as beta that can be used to eliminate a parameter from the model (false), or keep a parameter in the model (true). If not supplied, all parameters will be assumed to be part of the model as if the array were filled with all true values. |
| real(kind=real64), | intent(in), | optional | :: | alpha |
The significance level at which to evaluate the confidence intervals. The default value is 0.05 such that a 95% confidence interval is calculated. |
The resulting model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(doe_model), | intent(in) | :: | mdl | |||
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x | ||
| real(kind=real64), | intent(in), | dimension(:) | :: | y |
Computes model diagnostics and goodness-of-fit metrics.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(doe_model), | intent(in) | :: | mdl |
The fitted DOE model. |
||
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x |
The M-by-N matrix of factor values used in model fitting. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | y |
The M-element array of observed responses. |
The resulting diagnostics.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(doe_model), | intent(in) | :: | mdl | |||
| real(kind=real64), | intent(in), | dimension(:) | :: | x_low | ||
| real(kind=real64), | intent(in), | dimension(:) | :: | x_high | ||
| character(len=*), | intent(in), | optional | :: | method | ||
| real(kind=real64), | intent(in), | optional | :: | tol |
Computes predictions with confidence and prediction intervals.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(doe_model), | intent(in) | :: | mdl |
The fitted DOE model. |
||
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x |
The M-by-N matrix at which to evaluate the model. |
|
| real(kind=real64), | intent(in), | optional | :: | alpha |
Significance level (default 0.05 for 95% CI). |
The predictions with intervals.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(doe_model), | intent(in) | :: | mdl | |||
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x | ||
| real(kind=real64), | intent(in), | optional | :: | alpha | ||
| real(kind=real64), | intent(in), | optional | :: | residual_mse |
Computes residual analysis data for model diagnostics.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(doe_model), | intent(in) | :: | mdl |
The fitted DOE model. |
||
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x |
The M-by-N matrix of factor values. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | y |
The M-element array of observed responses. |
The residual analysis results.
Generates a central composite design in coded variables.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | nfactors |
Number of factors. |
||
| character(len=*), | intent(in), | optional | :: | alpha_type |
Type: "orthogonal" (default), "rotatable", "uniform". |
|
| real(kind=real64), | intent(out) | :: | tbl(:,:) |
Design table (coded variables in [-1, +1] range). |
Computes the size of a central composite design.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | nfactors |
Number of factors. |
||
| character(len=*), | intent(in), | optional | :: | alpha_type |
Type of CCD: "orthogonal" (default), "rotatable", or "uniform". |
|
| integer(kind=int32), | intent(out) | :: | m |
Number of runs (rows). |
||
| integer(kind=int32), | intent(out) | :: | n |
Number of factors (columns). |
Converts coded variable values (-1, +1) to natural scale.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x_coded |
M-by-N matrix of coded values in range [-1, +1]. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | x_low |
N-element array of low values for each factor. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | x_high |
N-element array of high values for each factor. |
|
| real(kind=real64), | intent(out), | dimension(:,:) | :: | x_natural |
M-by-N matrix of natural (physical) variable values. |
Converts natural variable values to coded (-1, +1) scale.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in), | dimension(:,:) | :: | x_natural |
M-by-N matrix of natural (physical) variable values. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | x_low |
N-element array of low values for each factor. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | x_high |
N-element array of high values for each factor. |
|
| real(kind=real64), | intent(out), | dimension(:,:) | :: | x_coded |
M-by-N matrix of coded values in range [-1, +1]. |
Generates a 2-level fractional factorial design.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | nfactors |
Number of factors. |
||
| integer(kind=int32), | intent(in) | :: | fraction |
Fraction level (1 for 1/2, 2 for 1/4, etc.). |
||
| integer(kind=int32), | intent(out) | :: | tbl(:,:) |
Design table (runs × factors), coded as 1 and 2. |
Computes the size of a fractional factorial design.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | nfactors |
Number of factors (k). |
||
| integer(kind=int32), | intent(in) | :: | fraction |
Fraction level (p): 1 for 1/2, 2 for 1/4, 3 for 1/8, etc. |
||
| integer(kind=int32), | intent(out) | :: | m |
Number of runs (rows). |
||
| integer(kind=int32), | intent(out) | :: | n |
Number of factors (columns), same as nfactors. |
Computes a table with values scaled from 1 to N describing a full-factorial design.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | vars(:) |
An M-element array containing the M factors to study. |
||
| integer(kind=int32), | intent(out) | :: | tbl(:,:) |
A table where the design will be written. Use get_full_factorial_matrix_size to determine the appropriate table size. |
Computes the appropriate size for a full-factorial design table.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | vars(:) |
An M-element array containing the M factors to study. Each
of the M entries to the array is expected to contain the
number of options for that particular factor to explore. |
||
| integer(kind=int32), | intent(out) | :: | m |
The number of rows for the table. |
||
| integer(kind=int32), | intent(out) | :: | n |
The number of columns for the table. |
Generates a Latin hypercube design for factor space exploration.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | nfactors |
Number of factors. |
||
| integer(kind=int32), | intent(in) | :: | nsamples |
Number of samples (runs). |
||
| integer(kind=int32), | intent(inout), | optional | :: | seed |
Random seed for reproducibility. |
|
| real(kind=real64), | intent(out) | :: | tbl(:,:) |
Latin hypercube design (nsamples × nfactors). |